<@_sysSite id=siteId><#assign a=object/></@_sysSite>
<div class="pageContent">
	<div class="pageFormContent" layoutH="57">
		<dl class="nowrap">
			<dt>站点名称：</dt>
			<dd>
				${(a.name)!}
			</dd>
		</dl>
		<dl class="nowrap">
			<dt>Nginx配置：</dt>
			<dd>
				<textarea name="description" style="width: 100%;" rows="20"><@_disk>
<@_sysDomainList admin=true siteId=siteId>
	<#if page.totalCount gt 0>
upstream publiccms_site_${siteId} {
	server localhost  weight=1;
}

		<#assign dynamicPath=a.dynamicPath/>
		<#if 0 = dynamicPath?index_of('http') || 0 = dynamicPath?index_of('//')>
			<#assign dynamicPath=dynamicPath?substring(dynamicPath?index_of('//')+2)/>
		</#if>
		<#if dynamicPath?index_of('/') gt 0>
			<#assign dynamicLocation=dynamicPath?substring(dynamicPath?index_of('/'))/>
			<#assign dynamicPath=dynamicPath?substring(0,dynamicPath?index_of('/'))/>
		</#if>
		<#if dynamicPath?index_of(':') gt 0>
			<#assign dynamicPort=dynamicPath?substring(sitePath?index_of(':')+1)/>
		</#if>
		<#assign ports =[dynamicPort!80]/>
		<#assign domains=[]/>
		<#list page.list as d>
			<#assign domainArray=d.name?split(':')/>
			<#if domainArray?size gt 1>
				<#if !ports?seq_contains(domainArray[1])>
					<#assign ports+=[domainArray[1]]/>
				</#if>
			</#if>
			<#if !domains?seq_contains(domainArray[0])>
				<#assign domains+=[domainArray[0]]/>
			</#if>
		</#list>
server {
		<#list ports as port>
	listen       ${port};
		</#list>
	server_name  <#list domains as domain>${domain}<#sep> </#list>;
	access_log  ${rootPath}/log/site_${siteId}.log;
	#开启ssi配置 如果http包已经配置过，这里可以删掉  begin
	ssi on;
	ssi_silent_errors on;
	#开启ssi配置 如果http包已经配置过，这里可以删掉  end
	location ${dynamicLocation!'/'} {
		#反向代理配置 如果http包已经配置过，这里可以删掉 begin
		proxy_redirect off;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_connect_timeout 5;
		proxy_send_timeout 30;
		proxy_read_timeout 10;
		#反向代理配置 如果http包已经配置过，这里可以删掉  end
		proxy_pass http://publiccms_site_${siteId};
	}
	location /include/ {
		alias ${rootPath}/static/site_${siteId}/include/;
	}
			<#if a.resourcePath?starts_with(a.dynamicPath)>
	location /${a.resourcePath?substring(a.dynamicPath.length)} {
		alias ${rootPath}/resource/site_${siteId}/;
	}
			</#if>
}
	</#if>
</@_sysDomainList>

	<#assign sitePath=a.sitePath/>
	<#if 0 = sitePath?index_of('http') || 0 = sitePath?index_of('//')>
		<#assign sitePath=sitePath?substring(sitePath?index_of('//')+2)/>
	</#if>
	<#if sitePath?index_of('/') gt 0>
		<#assign siteLocation=sitePath?substring(sitePath?index_of('/'))/>
		<#assign sitePath=sitePath?substring(0,sitePath?index_of('/'))/>
	</#if>
	<#if sitePath?index_of(':') gt 0>
		<#assign sitePort=sitePath?substring(sitePath?index_of(':')+1)/>
		<#if sitePort?index_of('/') gt 0>
			<#assign sitePort=sitePath?substring(0,sitePort?index_of('/'))/>
		</#if>
	</#if>
server {
	listen       ${sitePort!80};
	server_name  ${sitePath};
	#开启ssi配置 如果http包已经配置过，这里可以删掉  begin
	ssi on;
	ssi_silent_errors on;
	#开启ssi配置 如果http包已经配置过，这里可以删掉  end

	location ${siteLocation!'/'} {
		root   ${rootPath}/static/site_${siteId}/;
		index  index.html;
	}
	
	<#if a.resourcePath?starts_with(a.sitePath)>
	location /${a.resourcePath?substring(a.sitePath?length)} {
		alias ${rootPath}/resource/site_${siteId}/;
	}
	</#if>
}
<#if !a.resourcePath?starts_with(a.sitePath)&&!a.resourcePath?starts_with(a.dynamicPath)>
	<#assign resourcePath=a.resourcePath/>
	<#if 0 = resourcePath?index_of('http') || 0 = resourcePath?index_of('//')>
		<#assign resourcePath=resourcePath?substring(resourcePath?index_of('//')+2)/>
	</#if>
	<#if resourcePath?index_of('/') gt 0>
		<#assign resourceLocation=resourcePath?substring(resourcePath?index_of('/'))/>
		<#assign resourcePath=resourcePath?substring(0,resourcePath?index_of('/'))/>
	</#if>
	<#if resourcePath?index_of(':') gt 0>
		<#assign resourcePort=resourcePath?substring(resourcePath?index_of(':')+1)/>
		<#if resourcePort?index_of('/') gt 0>
			<#assign resourcePort=resourcePath?substring(0,resourcePort?index_of('/'))/>
		</#if>
	</#if>
server {
	listen       ${resourcePort!80};
	server_name  ${resourcePath};

	location ${resourceLocation!'/'} {
		root   ${rootPath}/resource/site_${siteId}/;
		index  index.html;
	}
}</#if></@_disk></textarea>
				<span class="info">本段配置应该包含在nginx配置文件 http包中</span>
			</dd>
		</dl>
	</div>
	<div class="formBar">
		<ul>
			<li><div class="button"><div class="buttonContent"><button type="button" class="close">关闭</button></div></div></li>
		</ul>
	</div>
</div>